/* $Id: HackJavaCpp.java.in,v 1.15 2009-01-12 09:46:33 rzr Exp $ */
#ifndef HackJavaCpp_java_in_
#define HackJavaCpp_java_in_

#include "Config.java.in"
/**
 * @author www.Philippe.COVAL.free.fr
 * Copyright and License : http://rzr.online.fr/license.htm
 **/
// Then edit *.java.in : 

// This in a template java source file which can be preprocessed with GNU cpp
// see CppHack.java.in

// File Generated this way (may help):
//
//  cp ${SRCDIR}Cpphack.java.in ${TMPDIR}$@
//        sed -e "s/\s*\/\/@cpp \(.*\)/\1/g" < $^ | \
//        cpp -undef -fno-show-column ${DEFINES} -C -P \
//        | grep -v "^#" >> ${TMPDIR}$@

// You can think it is ugly, but it saved some of my time
// If you want more details contact me 
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#if ( ! defined DEVEL ) 
#define MACRO_print(x)  
#define MACRO_println(x) 
#else
#define MACRO_print(x) System.out.print(x)
#define MACRO_println(x) System.out.println(x)
#endif

#ifdef  DEVEL 
#define debug MACRO_println
#endif

#define debug2lt( a , b )			\
  MACRO_println("( " + a +" < " + b + " )"); 

#define debug2ltif( a , b )			\
  if ( a < b ) { debug2lt(a,b); }

#define debug2gt( a , b )			\
  MACRO_println("( " + a +" > " + b + " )"); 

#define debug2gtif( a , b )			\
  if ( a > b ) { debug2gt(a,b); }

#define debug3lt( a , b , c )				\
  MACRO_println("( " + a +" < " + b +" < " + c + " )");



#define FPfloat int
//#define FPpow 
#define FPoff 8
#define FPtoFloat(a) ( a << FPoff ) //masks CHECK
#define FPtoInt(a) (a >> FPoff ) //masks CHECK

#define FPmult(a,b) ( (a*b) >> FPoff )

//#define FPdiv(x,y)    ((((x)<<6)/((y)>>6))>>4) //16:16 flipcode
#define FPdiv(a,b) ( (a << (FPoff<<1)) / (b << FPoff ) ) //ok 


#define FPdivProtected(a,b,c)  ( b != 0 ) ? FPdiv(a,b) : c

#define toint FPtoInt
#define tofloat FPtoFloat

#define TYPE_COLOR        int

#ifdef AWT
# define COLOR(x)         ( new Color(x) )
//#define TYPE_COLOR       Color

#elif defined ANDROID
# define COLOR(x) Color.x
#else
# define COLOR(x) x
#endif

// http://code.google.com/intl/fr-FR/android/reference/android/graphics/Color.html
#ifdef ANDROID
# define COLOR_WHITE 	COLOR(WHITE)
# define COLOR_BLACK	COLOR(BLACK)
# define COLOR_YELLOW	COLOR(YELLOW)
# define COLOR_RED	COLOR(RED)
# define COLOR_GREEN	COLOR(GREEN)
# define COLOR_BLUE     COLOR(BLUE)
#else
# define COLOR_BLACK      0x00000000
# define COLOR_WHITE      0x00FFFFFF
# define COLOR_YELLOW     0x00FFFF00
# define COLOR_RED        0x00FF0000
# define COLOR_GREEN      0x0000FF00
# define COLOR_BLUE       0x000000FF
#endif


#ifdef WANT_DARK
# define COLOR_BG         COLOR_BLACK
# define COLOR_FG         COLOR_WHITE
# define COLOR_FG_POINT   COLOR_YELLOW
# define COLOR_FG_LINE    COLOR_GREEN
# define COLOR_FG_TEST    (COLOR_RED | COLOR_BLUE)
# define COLOR_FG_FACE    0x000000E0
#else
# define COLOR_BG         COLOR_WHITE
# define COLOR_FG         COLOR_BLACK
# define COLOR_FG_POINT   COLOR_RED
# define COLOR_FG_LINE    COLOR_GREEN
# define COLOR_FG_TEST    0x00FF00FF
# define COLOR_FG_FACE    0x000000E0
#endif




#define swap(a,b,t) { t=a; a=b; b=t; }

#define clip(x,min,max)  (( x < min) ? min : ( (x > max)  ? max : x ))


//#define debug(x) System.out.println(x)

#define ZSORT
#define PIXEL

#ifdef DEVEL
#define MAPPING
#endif

#ifdef NOKIA
//#define WANT_NO_TUX
#endif


#endif //HackJavaCpp_java_in_

/* #eof "$Id: HackJavaCpp.java.in,v 1.15 2009-01-12 09:46:33 rzr Exp $" */
